class UsersController < ApplicationController
  def show
    user_id = 1 #params[:id] || session[:user_id]
    @user = User.find user_id if user_id
  end

  def new
  end
  
  def create
  return unless request.post?
    @user = User.new params[:user]
    begin
      @user.save!
      redirect_to_login
    rescue
      @user
	  render :action=>'new'
    end
  end

  def edit
    @user = User.find params[:id]
  end

  private
  def redirect_to_index(user)
    redirect_to user_path(user)
  end

  def redirect_to_login
    redirect_to login_path
  end

end
